package team.seekers.hula.common.entity.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;
import lombok.Getter;

import java.util.Arrays;


@Getter
public enum CourseRoleEnum implements IEnum<Integer> {
    USER(0,"用户"),
    INT_USER(1,"候浪者"),
    CO_CREATOR(2,"浪者"),
    MANAGER(3,"主理人"),
    BAN(4,"封禁");
    private int type;

    private String name;


    CourseRoleEnum(int type, String name) {
        this.type = type;
        this.name = name;
    }
    @Override
    public Integer getValue() {
        return null;
    }
    public static CourseRoleEnum getByType(int type) {
        return Arrays.stream(values()).filter(e -> e.getType() == type).findFirst().orElse(null);
    }

    public static CourseRoleEnum getByName(String name) {
        return Arrays.stream(values()).filter(e -> e.getName().equals(name)).findFirst().orElse(null);
    }
}
